{extend name="base" /} {block name="body"}

<!--tab标签-->
<div class="layui-tab-brief">
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <form class="layui-form form-container" data-url="{:url('admin/articlecate/save')}" localtion-url="{:url('articlecate/index')}">
                <div class="layui-form-item">
                    <label class="layui-form-label">排序</label>
                    <div class="layui-input-inline">
                        <input type="text" name="sort" placeholder="仅限整数" autocomplete="off" class="layui-input" value="1">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">栏目名称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="name" required lay-verify="required" placeholder="必填内容" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item" style="width: 300px;">
                    <label class="layui-form-label">所属栏目</label>
                    <div class="layui-input-block">
                        <select name="tid">
                          <option value="0">顶级栏目</option>
                          {volist name="category_level_list" id="vo"}
                        <option value="{$vo.id}">{neq name="vo.level" value="1"}|{php}for($i=1;$i<$vo['level'];$i++){echo ' --';}{/php}{/neq}{$vo.name}</option>
                           {/volist}
                          </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">别名</label>
                    <div class="layui-input-inline">
                        <input type="text" name="alias" required lay-verify="required" placeholder="必填内容，英文" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">图标</label>
                    <div class="layui-input-inline">
                        <input type="text" name="icon" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">标题背景</label>
                    <div class="layui-input-inline">
                        <input type="text" name="background" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">内容模板</label>
                    <div class="layui-input-inline">
                        <select name="template">
                                    <option value="article" selected="selected">文章模板</option>
                                    <option value="soft">软件模板</option>
                                    <option value="page">单页模板</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">列表模板</label>
                    <div class="layui-input-inline">
                        <select name="list_template">
                                    <option value="articlelist" selected="selected">文章列表模板</option>
                                    <option value="softlist">软件列表模板</option>
                                    <option value="pagelist">单页列表模板</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">关键词</label>
                    <div class="layui-input-block">
                        <input type="text" name="keywords" placeholder="请输入内容" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">描述</label>
                    <div class="layui-input-block">
                        <textarea name="description" placeholder="请输入内容" class="layui-textarea"></textarea>
                    </div>
                </div>
                <div class="btable-paged">
                    <div class="layui-main">
                        <div class="formbtngroup">
                            <button class="layui-btn layui-btn-small" lay-submit="" lay-filter="formadd">添加</button>
                            <button onclick="history.go(-1);return false;" class="layui-btn layui-btn-primary layui-btn-small">返回</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

{/block} {block name="js"}
<script type="text/javascript" src="__ADMIN__/js/formadd.js"></script>
{/block} {block name="script"}
<script>
    layui.use(['form', 'upload'], function() {
        var form = layui.form,
            upload = layui.upload,
            jq = layui.jquery;
        upload.render({
            elem: '#image',
            url: '{:url("upload/upimage")}',
            before: function(obj) {
                obj.preview(function(index, file, result) {
                    jq('#picshow').attr('src', result); //图片链接（base64）
                });
            },
            done: function(res) {
                if (res.code == '200') {
                    jq('input[name=pic]').val(res.path);
                    return layer.msg('上传成功');
                } else {
                    return layer.msg(res.msg);
                }

            }
        });
    })
</script>
{/block}